package com.infoland.afanmall.model.order.adapter;


import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.infoland.afanmall.R;
import com.infoland.afanmall.base.util.ToolsKit;
import com.infoland.afanmall.model.order.entity.OrderSelectResponse;
import com.infoland.afanmall.model.order.linster.OrderInfoLinster;

import java.util.List;

/**
 * 订单的子订单
 * 适配器
 */


public class Order_Item_Item_Adapter extends BaseQuickAdapter<OrderSelectResponse.ListBean.OrderItemListBean, BaseViewHolder> {


    public Order_Item_Item_Adapter(int layoutResId, @Nullable List<OrderSelectResponse.ListBean.OrderItemListBean> data) {
        super(R.layout.order_my_item_item, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, OrderSelectResponse.ListBean.OrderItemListBean item) {
        if (item != null) {
            helper.setText(R.id.order_my_item_count, "x " + item.getGoods_count() + "");
            helper.setText(R.id.order_my_item_item_price, "￥" + item.getGoods_price() + "");
            helper.setText(R.id.order_my_item_txt_content, item.getGoods_name());
            ToolsKit.setImgView(item.getF_url() + "", helper.getView(R.id.order_my_item_img));
            helper.getView(R.id.order_my_item_ll).setOnClickListener(v -> {
                orderInfoLinster.click(item);
            });
        }
    }

    OrderInfoLinster orderInfoLinster;

    public void setOrderInfoLinster(OrderInfoLinster orderInfoLinster) {
        this.orderInfoLinster = orderInfoLinster;
    }
}
